package com.atguigu.lease.common.context;

public class LoginUserContext {

    private LoginUserContext(){}
    private static LoginUserContext instance = new LoginUserContext();
    public static synchronized final LoginUserContext getInstance(){
        if(instance==null){
            instance = new LoginUserContext();
        }
        return instance ;
    }

    private ThreadLocal<Long> tl = new ThreadLocal<>();

    public Long getUserId(){
        return tl.get();
    }

    public void setUserId(Long userId){
        tl.set(userId);
    }


}
